package com.ctshk.rpc.custom.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ctshk.rpc.custom.dto.trip.TouristTypeCountDTO;
import com.ctshk.rpc.custom.entity.CustomizedTripScheduleTouristCount;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 团期旅客类型统计 Mapper 接口
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-03-12
 */
public interface CustomizedTripScheduleTouristCountMapper extends BaseMapper<CustomizedTripScheduleTouristCount> {

    /**
     * 根据旅客类型获取
     * @param touristId
     * @param scheduleId
     * @return
     */
    @Select("SELECT * \n" +
            "FROM t_customized_trip_schedule_tourist_count\n" +
            "WHERE schedule_id = #{schedule_id} AND tourist_type_id = #{tourist_id} AND is_deleted = 0 LIMIT 1 ")
    CustomizedTripScheduleTouristCount queryByTourist(@Param("tourist_id") Long touristId, @Param("schedule_id") Long scheduleId);

    /**
     * 报名人数
     * @param scheduleId
     * @return
     */
    @Select("SELECT tourist_type_id,tourist_type_name,order_people AS peopleNumber \n" +
            "FROM t_customized_trip_schedule_tourist_count\n" +
            "WHERE schedule_id = #{schedule_id} AND is_deleted = 0")
    List<TouristTypeCountDTO> queeryBySchedule(@Param("schedule_id")Long scheduleId);
}
